package cn.edu.wynu.springbootlearn.mapper;

import cn.edu.wynu.springbootlearn.bean.Movie;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

// 将当前类注入到IOC容器里面，供其他组件使用
@Mapper
public interface MovieMapper {

    // @Select注解的作用是代表该接口是一个查询接口
    @Select("select * from movies")
    List<Movie> allMovie();

    @Select("select * from movies where id = #{id}")
    Movie selectMovieById(Integer id);

    @Update("update movies set movie_name = #{movieName} where id = #{id}")
    Integer updateMovie(Movie movie);
}
